package com.rabbit.eap.framework.core.util;

import com.rabbit.eap.framework.core.domain.RequestDetail;

/**
 * @projectName eap
 * @packageName com.rabbit.eap.framework.core.util
 * @className RequestDetailThreadLocal
 * @author： rabbit
 * @version： 1.0
 * @since： 2020/4/26 21:51
 * <p>Description: RequestDetailThreadLocal
 * 记录请求详情信息到当前线程中，可在任何地方获取
 * </p>

 */
public class RequestDetailThreadLocal {
    private static ThreadLocal<RequestDetail> threadLocal = new ThreadLocal<>();

    /**
     * 设置请求信息到当前线程中
     *
     * @param requestDetail
     */
    public static void setRequestDetail(RequestDetail requestDetail) {
        threadLocal.set(requestDetail);
    }

    /**
     * 从当前线程中获取请求信息
     */
    public static RequestDetail getRequestDetail() {
        return threadLocal.get();
    }

    /**
     * 销毁
     */
    public static void remove() {
        threadLocal.remove();
    }
}
